
import FlowPolylineMaterialShader from "../shader/polyline/FlowPolylineMaterialShader.glsl?raw";
import PolylineTrailMaterialShader from "../shader/polyline/PolylineTrailMaterialShader.glsl?raw";
import PolylineLightingTrailMaterialShader from "../shader/polyline/PolylineLightingTrailMaterialShader.glsl?raw";
import FlowAlphaPolylineMaterialShader from "../shader/polyline/FlowAlphaPolylineMaterialShader.glsl?raw";
import PolylineFadeMaterialShader from "../shader/polyline/PolylineFadeMaterialShader.glsl?raw";

/**
 * 流动图片材质线
 */
import image from '../image/polyline/line.png'

Cesium.Material.FlowPolylineMaterialType = 'FlowPolyline'
Cesium.Material._materialCache.addMaterial(Cesium.Material.FlowPolylineMaterialType, {
  fabric: {
    type: Cesium.Material.FlowPolylineMaterialType,
    uniforms: {
      speed :1.0,
      color : Cesium.Color.YELLOW,
      image,
      repeat : 1.0
    },
    source: FlowPolylineMaterialShader
  },
  translucent: function (material) {
    return true
  }
})


/**
 * 流动颜色材质线
 */

 Cesium.Material.PolylineTrailMaterialType = 'PolylineTrail'
 Cesium.Material._materialCache.addMaterial(Cesium.Material.PolylineTrailMaterialType, {
   fabric: {
     type: Cesium.Material.PolylineTrailMaterialType,
     uniforms: {
       speed :1.0,
       color : Cesium.Color.SKYBLUE,
       repeat : 1.0
     },
     source: PolylineTrailMaterialShader
   },
   translucent: function (material) {
     return true
   }
 })

 /**
 * 流动颜色材质发光线
 */
import lighting from '../image/polyline/lighting.png'

Cesium.Material.PolylineLightingTrailMaterialType = 'PolylineLightingTrail'
Cesium.Material._materialCache.addMaterial(Cesium.Material.PolylineLightingTrailMaterialType, {
  fabric: {
    type: Cesium.Material.PolylineLightingTrailMaterialType,
    uniforms: {
      speed :1.0,
      color : Cesium.Color.SKYBLUE,
      image : lighting,
      repeat : 1.0
    },
    source: PolylineLightingTrailMaterialShader
  },
  translucent: function (material) {
    return true
  }
})

/**
 * 流动材质 有透明度材质线
 */

Cesium.Material.FlowAlphaPolylineMaterialType = 'FlowAlphaPolyline'
Cesium.Material._materialCache.addMaterial(Cesium.Material.FlowAlphaPolylineMaterialType, {
  fabric: {
    type: Cesium.Material.FlowAlphaPolylineMaterialType,
    uniforms: {
      speed :1.0,
      color : Cesium.Color.SKYBLUE,
      percent : 0.1,
      gradient : 0.1
    },
    source: FlowAlphaPolylineMaterialShader
  },
  translucent: function (material) {
    return true
  }
})

/**
 * 渐隐渐出现
 */

Cesium.Material.PolylineFadeMaterialType = 'PolylineFade'
Cesium.Material._materialCache.addMaterial(Cesium.Material.PolylineFadeMaterialType, {
  fabric: {
    type: Cesium.Material.PolylineFadeMaterialType,
    uniforms: {
      speed :1.0,
      color : Cesium.Color.SKYBLUE
    },
    source: PolylineFadeMaterialShader
  },
  translucent: function (material) {
    return true
  }
})





